<%@ taglib uri="/WEB-INF/myfaces_html.tld" 	prefix="h" %>
<%@ taglib uri="/WEB-INF/myfaces_core.tld" 	prefix="f" %>
<%@ taglib uri="/WEB-INF/tomahawk.tld"     	prefix="t" %>
<%@ page import="java.util.ArrayList" %>

<f:view>
    <jsp:include page="/intestazione.jsp">
        <jsp:param name="titolo" value="Gestione News"/>
    </jsp:include>
    <jsp:include page="/menu.jsp"/>
    <script language="javascript" src="./script/popup_full_center.js"></script>
    <script language="javascript" src="./script/confirmCM.js"></script>

    <br />
    <table class="find" style="border: 2pt solid white; margin-bottom: -10px">
        <hr />
        <tr>  
            <td class="intestazionePagina" align="center">
                <strong>GESTIONE News</strong></td>                        
        </tr>        
    </table>

    <t:saveState value="#{beanNews}"/>
    <h:form binding="#{dettaglioNews.form}" id="formLookup">              
        <br/>
        <table class="dettaglio">
            <tbody>          
                <tr>                   
                    <td class="etichettaDettaglio"><strong><t:outputLabel for="codice" value="Codice News (*)"/></strong></td>
                    <td><t:inputText id="codice" value="#{beanNews.codice}" size="10" maxlength="5" styleClass="dettaglio_InputText" immediate="true" disabled="true"/></td>
                </tr>              

                <tr> 
                    <td class="etichettaDettaglio"><strong><t:outputLabel for="data" value="Data (*)"/></strong></td>
                        <td><h:outputText value=" (gg/mm/aaaa)" style="font-size:6.5pt"/>
                        <br/>
                        <t:inputCalendar id="data" renderAsPopup="true" renderPopupButtonAsImage="true" popupDateFormat="dd/MM/yyyy" size="10" styleClass="campoTesto" value="#{beanNews.data}">
                            <f:convertDateTime pattern="dd/MM/yyyy" type="both" timeZone="Europe/Rome"/>
                        </t:inputCalendar>
                        <h:message style="color: red" for="data" showDetail="true" showSummary="false" />
                        </td>
                    </tr>   

                    <tr>                   
                        <td class="etichettaDettaglio"><strong><t:outputLabel for="titolo" value="Titolo (*)"/></strong></td>
                        <td><t:inputText id="titolo" value="#{beanNews.titolo}" styleClass="dettaglio_InputText" onchange="this.value=this.value.toUpperCase()" size="75" maxlength="100" required="true"/>
                            <h:message style="color: red" for="titolo" showDetail="true" showSummary="false" /></td>
                    </tr>   

                    <tr>                   
                        <td class="etichettaDettaglio"><strong><t:outputLabel for="corpo" value="Corpo (*)"/></strong></td>
                        <td><t:inputText id="corpo" value="#{beanNews.corpo}" styleClass="dettaglio_InputText" onchange="this.value=this.value.toUpperCase()" size="90" maxlength="256" required="true"/>
                            <h:message style="color: red" for="corpo" showDetail="true" showSummary="false" /></td>
                    </tr>   
                    
                     <tr>                   
                    <td class="etichettaDettaglio"><strong><t:outputLabel for="visualizza" value="Pubblica(*)"/></strong></td>
                    <td>
                        <t:selectOneMenu id="visualizza" value="#{beanNews.visualizza}">
                            <f:selectItem itemValue="S" itemLabel="Si"/>
                            <f:selectItem itemValue="N" itemLabel="No"/>
                        </t:selectOneMenu>  
                    </td>
                </tr> 

            </table>
            <br/>

            <t:inputHidden value="#{beanNews.id}"/>
            <table bgcolor="#FFFFFF" width="750px">
                <tr>     
                    <td>
                        <h:commandLink styleClass="commandLink_Style" dir="RTL" action="benvenuto" immediate="true">
                            <t:graphicImage url="/image/go-home.png" border="0"/>
                        </h:commandLink>              
                    </td>   
                    <td>
                        <t:commandLink action="#{dettaglioNews.primo}"  rendered="#{beanNews.id ne null}">
                            <t:graphicImage url="image/primo.png" border="0" title="Vai al primo elemento"/>
                            <f:param name="bean" value="beanNews"/>                        
                            <f:param name="id" value="#{beanNews.id}"/>                 
                        </t:commandLink>
                    </td>
                    <td>
                        <t:commandLink action="#{dettaglioNews.precedente}" rendered="#{beanNews.id ne null}">
                            <t:graphicImage url="image/indietro.png" border="0" title="Indietro"/>
                            <f:param name="bean" value="beanNews"/>                        
                            <f:param name="id" value="#{beanNews.id}"/>                 
                        </t:commandLink>
                    </td>
                    <td>
                        <t:commandLink action="#{dettaglioNews.successivo}" rendered="#{beanNews.id ne null}">
                            <t:graphicImage url="image/avanti.png" border="0" title="Avanti"/>
                            <f:param name="bean" value="beanNews"/>                        
                            <f:param name="id" value="#{beanNews.id}"/>                 
                        </t:commandLink>
                    </td>
                    <td>
                        <t:commandLink action="#{dettaglioNews.ultimo}" rendered="#{beanNews.id ne null}">
                            <t:graphicImage url="image/ultimo.png" border="0" title="Vai all'ultimo elemento"/>
                            <f:param name="bean" value="beanNews"/>                        
                            <f:param name="id" value="#{beanNews.id}"/>                 
                        </t:commandLink>
                    </td>

                    <td>
                        <h:commandLink dir="RTL" onmousedown="return confirmDelete(this);" title="cancella" action="#{dettaglioNews.cancella}" rendered="#{beanNews.id ne null}">
                            <t:graphicImage url="image/stop.png" border="0" title="Cancella"/>
                            <f:param name="bean" value="beanNews" />
                        </h:commandLink>                
                    </td>      

                    <td>
                        <h:commandLink dir="RTL" onmousedown="return confirmUpdate(this);" title="modifica" action="#{dettaglioNews.modifica}" rendered="#{beanNews.id ne null}">
                            <t:graphicImage url="image/salva.png" border="0" title="Salva modifiche"/>
                            <f:param name="bean" value="beanNews" />
                        </h:commandLink>                
                    </td>    

                    <td>
                        <h:commandLink dir="RTL" onmousedown="return confirmSave(this);" title="salva inserimento" action="#{dettaglioNews.inserisci}" rendered="#{beanNews.id eq null}">
                            <t:graphicImage url="image/salva.png" border="0" title="Salva inserimento"/>
                            <f:param name="bean" value="beanNews" />
                        </h:commandLink>                
                    </td>
                    <%--
                    <td>
                    <h:commandLink dir="RTL" title="Annulla operazione" action="#{dettaglioNews.annulla}" rendered="#{beanNews.id eq null}" immediate="true">
                    <t:graphicImage url="image/delete.png" border="0"/>
                    <f:param name="bean" value="beanNews" />
                    </h:commandLink>                     
                    </td>
                    --%>
                    <td>
                        <h:commandLink dir="RTL" title="inserisce nuovo elemento" action="#{dettaglioNews.inserisciDettaglio}" rendered="#{beanNews.id ne null}">
                            <t:graphicImage url="image/nuovo.png" border="0" title="Inserisci NUOVO"/>
                            <f:param name="bean" value="beanNews" />
                        </h:commandLink>
                    </td>

                    <td>
                        <h:commandLink  title="LISTA" id="lista" action="#{dettaglioNews.lista}" rendered="#{beanNews.id ne null}">
                            <t:graphicImage url="image/lista.png" border="0" title="Carica lista" style="width:32px; height:32px"/>
                            <f:param name="bean" value="News" />
                        </h:commandLink>
                    </td>

                    <td>                
                        <t:commandLink id="cerca1" onclick="loadurl('pages_ricerca/ricercaNews.jsf');" immediate="true" rendered="#{beanNews.id ne null}">
                            <t:graphicImage url="image/find.png" border="0" title="Cerca Elemento" style="width:32px; height:32px"/>
                        </t:commandLink>
                    </td> 

                    <td>                
                        <t:commandLink id="aiuto" onclick="loadurl('info/legendaBottoniDettaglio.jsf');" immediate="true">
                            <t:graphicImage url="image/help.png" border="0" title="Aiuto"/>
                        </t:commandLink>
                    </td> 
                </tr>
            </table>
    </h:form> 

    <h:form id="erroriDataBase" rendered="false">
        <f:verbatim><table><td align="left" class="messaggiErrore" height="2px"></f:verbatim>           
                <h:messages style="color: red" showDetail="true" showSummary="false"/>
                <f:verbatim></td></table></f:verbatim>
            </h:form>     

    <jsp:include page="/piePagina.jsp"/>      
</f:view>
